package com.avic.gateway.model;

import com.avic.gateway.common.util.ex.BizErrorCode;
import com.avic.gateway.common.util.lang.BaseResponse;
import lombok.Data;

/**
 * @author: huangsheng
 * @date: 2018/8/24
 */
@Data
public class GatewayResponse extends BaseResponse {

    public static GatewayResponse initErrorResponse(BizErrorCode bizErrorCode) {
        GatewayResponse gatewayResponse = new GatewayResponse();
        gatewayResponse.setCode(bizErrorCode.getCode());
        gatewayResponse.setMessage(bizErrorCode.getDescription());
        return gatewayResponse;
    }

    public static GatewayResponse initErrorResponse(BizErrorCode bizErrorCode, String message) {
        GatewayResponse gatewayResponse = new GatewayResponse();
        gatewayResponse.setCode(bizErrorCode.getCode());
        gatewayResponse.setMessage(message);
        return gatewayResponse;
    }
}
